getOrPut

inline fun getOrPut(key: Long, context: Context? = null, crossinline compute: () -> Float): Float

EN Reads from the cache or computes (and stores) a new value. Lock-free.

The full hot path is inlined at every call-site by the Kotlin compiler. This eliminates all method-call overhead and gives the JIT full visibility over the loop body when called from a batch context.

getOrPutInternal is kept as a non-inline helper for callers (like getBatch) that cannot use inline functions.

Return

Cached or freshly-computed raw Float result

PT O hot path completo é inlinado em cada call-site pelo compilador Kotlin, eliminando overhead de chamada e dando ao JIT visibilidade total do loop.

Parameters

key

64-bit packed key from buildKey

compute

Lambda invoked only on a cache miss


inline fun getOrPut(key: Long, crossinline compute: () -> Float): Float

Backward compatibility for non-context calls.